class Animal{
    public String name;
    public int age;

    public Animal(String name,int age){
        this.name = name;
        this.age = age;
    }

    public void eat(){
        System.out.println(this.name+"正在吃饭！");
    }
}

class Dog extends Animal{

    public Dog(String name, int age) {
        super(name,age);
    }
    @Override
    public void eat(){
        System.out.println(this.name+"正在吃狗粮！");
    }

    public void bark(){
        System.out.println(this.name+"正在汪汪叫！");
    }

    @Override
    public String toString() {
        return "Dog{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}

class Cat extends Animal{
    public Cat(String name, int age){
        super(name,age);
    }

    @Override
    public void eat() {
        System.out.println(this.name+"正在吃猫粮！");
    }

}

public class Test {

    public static void func(Animal animal){
        animal.eat();
    }

    public static void main(String[] args) {
        Dog dog = new Dog("大黄",18);
        func(dog);
        Cat cat = new Cat("小花",12);
        func(cat);
    }
}
